<template>
    <el-form :inline="true" ref="queryForm">
        <el-form-item label="单个文件数据条数">
            <el-input v-model="formFilter.num" style="width: 80px;"></el-input>
        </el-form-item>
        <el-form-item>
            <el-button type="success" icon='el-icon-video-play' style="width: 300px" @click="startAttention" :loading="loading">开始采集</el-button>
        </el-form-item>
        <el-divider  content-position="left">用户信息</el-divider>
        <el-button icon="el-icon-refresh" circle :loading="refreshLoading" @click="queryFn"></el-button>
    </el-form>
</template>

<script>
  import { startTask } from '@/api/filtrate'
  import eventBus from "../../utils/eventBus";

  export default {
    name: "tool",
    data () {
      return {
        options: ['通过', '拒绝'],
        formFilter: {
          "num": ''
        },
        refreshLoading: false,
        loading: false
      }
    },
    props: {
      get: Function,
      selectionVideo: Array
    },
    methods: {
      async queryFn () {
        try {
          this.refreshLoading = true
          this.get()
          this.refreshLoading = false
        }catch (e) {
          this.refreshLoading = false
          console.log(e)
        }
      },
      async startAttention (url) {
        try {
          this.loading = true
          const params = {taskType: '70', ...this.formFilter}
          const {data} = await startTask(params)
          this.$message.success('采集成功')
          this.formFilter.num = ''
          this.loading = false
          this.get()
        } catch (e) {
          this.loading = false
          console.log(e)
        }
      },
      // async stop () {
      //   try {
      //     const {data} = await stop()
      //   } catch (e) {
      //     console.log(e)
      //   }
      // },
      onRest () {
        this.formFilter = {
          "num": ''
        }
        eventBus.$emit('restTable')
      }
    }
  }
</script>

<style scoped>

</style>
